package meta.api.web.file.businessinfo;

import java.io.Serializable;
import java.util.Arrays;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

import meta.common.util.StrUtil;

/**
 * 元数据
 */
public class MetadataInfo implements Serializable {

    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = 1L;

    /**
     * 名
     */
    @JsonProperty
    private String name;

    /**
     * 标签字符串
     */
    @JsonIgnore
    private String tags;

    /**
     * 标签列表
     */
    @JsonProperty(value = "tags")
    private List<String> tagList;

    /**
     * 是否共享
     */
    @JsonProperty
    private boolean shared;

    /**
     * 目录
     */
    @JsonProperty
    private String directory;

    /**
     * 备注
     */
    @JsonProperty
    private String remarks;

    /**
     * 文件类型
     */
    @JsonProperty
    private String type;

    /**
     * 图片名
     */
    @JsonProperty(value = "imageFilename")
    private String imageName;

    /**
     * 图片URL
     */
    @JsonProperty(value = "image")
    private String imageUrl;

    /**
     * URL
     */
    @JsonProperty
    private String url;

    /**
     * 用户ID
     */
    @JsonProperty
    private String userid;

    /**
     * 用户名
     */
    @JsonProperty
    private String username;

    /**
     * 是否包含子目录文件
     */
    private boolean allChildren;

    public void rebuildTagList() {
        if (StrUtil.isNotEmpty(this.tags)) {
            this.tagList = Arrays.asList(this.tags.split(","));
        }
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTags() {
        return tags;
    }

    public void setTags(String tags) {
        this.tags = tags;
    }

    public List<String> getTagList() {
        return tagList;
    }

    public void setTagList(List<String> tagList) {
        this.tagList = tagList;
    }

    public boolean isShared() {
        return shared;
    }

    public void setShared(boolean shared) {
        this.shared = shared;
    }

    public String getDirectory() {
        return directory;
    }

    public void setDirectory(String directory) {
        this.directory = directory;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getImageName() {
        return imageName;
    }

    public void setImageName(String imageName) {
        this.imageName = imageName;
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getUserid() {
        return userid;
    }

    public void setUserid(String userid) {
        this.userid = userid;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public boolean isAllChildren() {
        return allChildren;
    }

    public void setAllChildren(boolean allChildren) {
        this.allChildren = allChildren;
    }
}
